
import serial
import sys

def main():
    serial_name = "/dev/ttys001"
    baudrate = 115200
    serial_conn=serial.Serial(serial_name,baudrate,timeout=0.5) 

    while serial_conn.isOpen():
        send_msg = raw_input()
        serial_conn.write(send_msg)
        sys.stdout.flush()  #flush the buffer
        recv_msg = serial_conn.readline()
        print("Recv > "+recv_msg)

if __name__=="__main__":
	main()
